package com.phkj.qdh.repository

import com.phkj.qdh.bean.FailoverReduceType
import com.phkj.qdh.net.FAILOVER_TYPE_LIST
import com.phkj.qdh.bean.FailoverTypeBean
import com.phkj.qdh.bean.ZheDiThing
import com.phkj.qdh.net.FAILOVER_REDUCE_THINGS
import com.phkj.qdh.net.FAILOVER_REDUCE_TYPE
import com.phkj.qdh.net.FAILOVER_SAVE
import com.phkj.qdh.net.FAILOVER_deductions
import com.phkj.qdh.net.PageList
import rxhttp3.RxHttp
import rxhttp3.toFlowResponse

object FailoverRepository {
    fun getFailoverTypeList(map:HashMap<String,Any?>)=
        RxHttp.get(FAILOVER_TYPE_LIST).addAll(map).toFlowResponse<ArrayList<FailoverTypeBean>>()

    fun saveFailover(map: HashMap<String, Any?>) =
        RxHttp.postJson(FAILOVER_SAVE).addAll(map).toFlowResponse<String>()

    fun getFailoverReduceType()=
        RxHttp.get(FAILOVER_REDUCE_TYPE).toFlowResponse<ArrayList<FailoverReduceType>>()

    fun getFailoverReduceThings(map: HashMap<String, Any?>)=
        RxHttp.get(FAILOVER_REDUCE_THINGS).addAll(map).toFlowResponse<PageList<ZheDiThing>>()

    fun getFailoverReduceTypeThings(map: HashMap<String, Any?>)=
        RxHttp.get(FAILOVER_deductions).addAll(map).toFlowResponse<PageList<ZheDiThing>>()

}